<?php
error_reporting ( E_ALL );
require 'header.php';
echo '<div class="panel-body">'.'<h2>用户信息验证</h2>';
if (! $_POST ['send']) {
    if(!$_COOKIE['name']){
	echo '你没有登录';
    }else {
	$zid = $_GET['zid'];
	echo "<form method='post'>
		<div class='input-group col-xs-4 divcenter'>
  		<span class='input-group-addon'><i class='icon icon-key'></i></span>
  		<input type='text' class='form-control input-lg' placeholder='输入密码' name='passwd'><br/><br/>
		<input type='hidden' name='sendzid' value='".$zid."'>
		</div>
		<br/>
		<div class='divcenter'>
		<input class='btn btn-danger' type='submit' value='验证' name='send'>
		</div>
		</form>";
    }
} else {
	if (! $_POST ['passwd'] || $_COOKIE['passwd'] != $_POST ['passwd']) {
		echo '必须填写正确的密码验证';
	} else {
		if ($_COOKIE['id'] == $_GET['userid'] || $_COOKIE['id'] == 1){
			$getzid = $_POST['sendzid'];
			echo "<form method='post' action='checkmod.php?id=$getzid'>
			    <div class='input-group col-xs-6 divcenter'>
			    <span class='input-group-addon'><i class='icon icon-location-arrow'></i></span>
			    <input class='form-control input-lg' type='text' placeholder='标题' name='titles'><br/><br/>
			    </div>
			    <div class='input-group col-xs-6 divcenter'>
			    <span class='input-group-addon'><i class='icon icon-tags'></i></span>
			    <input type='text' class='form-control input-lg' placeholder='标签' name='lables'><br/><br/>
			    </div>
			    <div class='input-group col-xs-6 divcenter'>
			    <span class='input-group-addon'><i class='icon icon-bookmark'></i></span>
			    <textarea class='form-control input-lg' rows='3' placeholder='内容' name='contents'></textarea>
			    </div><br/>
			    <div class='divcenter'><input class='btn btn-danger' type='submit' value='修改' name='mods'>
			    </div>
			    </form>";
		}else {
			echo '你不是文章拥有者,无权限';
		}
}
	}
require 'footer.php';